//
//  RMMGuangGaoView.m
//  Romomo
//
//  Created by puman on 16/10/8.
//  Copyright © 2016年 mazegong. All rights reserved.
//

#import "RMMGuangGaoView.h"

@implementation RMMGuangGaoView
- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = kWhiteColor;
        _imageV = [[UIImageView alloc] initWithFrame:self.bounds];
        _imageV.image = [UIImage imageNamed:@"kaijitu"];
        _imageV.userInteractionEnabled = YES;
        [self addSubview:_imageV];
        
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction)];
        [_imageV addGestureRecognizer:tap];

        UIView *view = [[UIView alloc] initWithFrame:CGRectMake(kScreenWideth - 69, 36, 54, 24)];
        view.layer.cornerRadius = 12;
        view.layer.masksToBounds = YES;
        view.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.3];
        [self addSubview:view];
        
        _skipLabel = [[UILabel alloc] initWithFrame:view.bounds];
        _skipLabel.font = kFont(12);
        _skipLabel.text = @"跳过 5";
        _skipLabel.textAlignment = NSTextAlignmentCenter;
        [self changeLabelTextColorOneWithLabel:_skipLabel];
        [view addSubview:_skipLabel];
        
        
        _skipBut = [UIButton buttonWithType:(UIButtonTypeCustom)];
        _skipBut.frame = view.bounds;
        [view addSubview:_skipBut];
    }
    return self;
}
- (void)changeLabelTextColorOneWithLabel:(UILabel *)label{
    NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:label.text];
    [attributedString addAttribute:NSForegroundColorAttributeName value:kWhiteColor range:NSMakeRange(0, 2)];
    [attributedString addAttribute:NSForegroundColorAttributeName value:COLORFROMCODE(0xF44336 , 1) range:NSMakeRange(3, 1)];
    [label setAttributedText:attributedString];
}
- (void)tapAction{
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
